layui.use(['form','layer','layedit','laydate','upload'],function(){
    var form = layui.form
    layer = parent.layer === undefined ? layui.layer : top.layer,
        laypage = layui.laypage,
        upload = layui.upload,
        layedit = layui.layedit,
        laydate = layui.laydate,
        $ = layui.jquery;

    form.on("submit(addArticle)",function(){
        if ($(".userUsername").val() == '' || $(".userUsername").val() == null){
            layer.msg("员工姓名不能为空");
            return;
        }
        if ($(".userRemark").val().length > 200){
            layer.msg("员工备注长度 0~200，当前长度："+$(".userRemark").val().length);
            return;
        }
        // 实际使用时的提交信息
        $.post("user/save",{
            userUsername : $(".userUsername").val(),
            userRemark : $(".userRemark").val(),

            userId : $(".userId").val(),
        },function(res){
            if (res.success){
                setTimeout(function(){
                    top.layer.msg(res.message);
                    layer.closeAll("iframe");
                    //刷新父页面
                    parent.location.reload();
                },500);
            }else{
                setTimeout(function(){
                    top.layer.msg(res.message);
                },500);
            }
        })
    })


})